from django.db import models


# Create your models here.


class Status(models.Model):
    name = models.CharField(max_length=30)

    def __str__(self):
        return self.name


class Leven(models.Model):
    name = models.CharField(max_length=30)

    def __str__(self):
        return self.name


class Coach(models.Model):
    status = models.ForeignKey(Status, on_delete=models.CASCADE, default=1)
    leven = models.ForeignKey(Leven, on_delete=models.CASCADE)
    name = models.CharField(max_length=30)
    cost = models.IntegerField()

    def __str__(self):
        return self.name


class Member(models.Model):
    name = models.CharField(max_length=30)
    pwd = models.CharField(max_length=150)
    counter = models.IntegerField(default=0)

    def __str__(self):
        return self.name


class Cart(models.Model):
    member = models.ForeignKey(Member, on_delete=models.CASCADE)
    coach = models.ForeignKey(Coach, on_delete=models.CASCADE)
    start_time = models.DateTimeField(auto_now_add=True)
    end_time = models.DateTimeField(auto_now=True)
    total = models.DecimalField(max_digits=7,decimal_places=2,default=0)
